#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
template<typename T>inline void read(T &a){char c=getchar();T x=0,f=1;while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<1)+(x<<3)+c-'0';c=getchar();}a=f*x;}
using namespace std;
const int maxn=5e3+1000;
typedef long long LL;
const LL mod=1e9+7;
LL dp[maxn][maxn],cnt[maxn];
LL a[maxn];
int main(void)
{
  ///cin.tie(0);std::ios::sync_with_stdio(false);
  LL n,k,q;read(n);read(k);read(q);
  for(LL i=1;i<=n;i++) read(a[i]);
  for(LL i=1;i<=n;i++) dp[i][0]=1;
  for(LL j=1;j<=k;j++){
    for(LL i=1;i<=n;i++){
        if(i!=1) dp[i][j]=(dp[i][j]%mod+dp[i-1][j-1]%mod)%mod;
        if(i!=n) dp[i][j]=(dp[i][j]%mod+dp[i+1][j-1]%mod)%mod;
    }
  }
  for(LL i=1;i<=n;i++){
    for(LL j=0;j<=k;j++){
        cnt[i]=(cnt[i]%mod+dp[i][j]*dp[i][k-j]%mod)%mod;
    }
  }
  LL sum=0;
  for(LL i=1;i<=n;i++) sum=(sum%mod+cnt[i]*a[i]%mod)%mod;
  for(LL i=1;i<=q;i++){
    LL j,x;read(j);read(x);
    sum=(sum%mod-a[j]*cnt[j]%mod+mod)%mod;
    a[j]=x;
    sum=(sum%mod+a[j]*cnt[j]%mod)%mod;
    printf("%lld\n",sum);
  }
return 0;
}
